GithubHelp home page GithubHelp logo

'popen' not supported about z.lua HOT 6 CLOSED

skywind3000 avatar skywind3000 commented on May 25, 2024
'popen' not supported

from z.lua.

Comments (6)

skywind3000 avatar skywind3000 commented on May 25, 2024

io.popen 是 lua 源代码中的标准函数:
https://github.com/lua/lua/blob/28d829c86712ce5bc453feccc5129a32f78d80c0/liolib.c#L277

你这个版本的 lua 编译的时候没有打开 popen,就是个宏,默认是打开的:
https://github.com/lua/lua/blob/28d829c86712ce5bc453feccc5129a32f78d80c0/liolib.c#L55-L74

请调查一下你的

LUA_USE_POSIX

或者

LUA_USE_LINUX

为什么没有打开?

只要正常编译,这个宏都是打开的,你看我的lua:

Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> print(io.popen('pwd'):read('*l'))
/home/skywind
>

from z.lua.

Yggdroot avatar Yggdroot commented on May 25, 2024

哦,那我重新编译一下。

from z.lua.

skywind3000 avatar skywind3000 commented on May 25, 2024

https://github.com/lua/lua/blob/4ace93ca6502dd1da38d5c06fa099d229e791ba8/makefile#L56

恩,LUA_USE_LINUX 这个宏再 Makefile 里面默认是开启的,开启后,luaconf.h 中会根据这个宏打开

LUA_USE_POSIX

然后就可以用 popen 了。
https://github.com/lua/lua/blob/4ace93ca6502dd1da38d5c06fa099d229e791ba8/luaconf.h#L61

from z.lua.

Yggdroot avatar Yggdroot commented on May 25, 2024

发现z.lua如果找不到匹配的路径,就呆在当前路径什么都不做。
可不可以有个这样的功能:当前路径有个目录叫aaa,我知道有这个目录,但是从没有进去过,我执行z aaa也可以进去。也就是说,如果找不到匹配的路径,就等同于cd。

from z.lua.

skywind3000 avatar skywind3000 commented on May 25, 2024

恩,修改好了:

export _ZL_MATCH_MODE=1

默认 0 的匹配模式留给默认的原教旨主义匹配法吧,新的匹配法我都挪到 _ZL_MATCH_MODE=1 下面了,包括之前的两个宏都可以省略了。

from z.lua.

Yggdroot avatar Yggdroot commented on May 25, 2024

嗯, 好了。

from z.lua.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.