简体   繁体   English

Windows / cygwin shebang线

[英]Windows/cygwin shebang line

I am using Sphinx quite often. 我经常使用Sphinx。 There is one index that calls a stored procedure with one param as input. 有一个索引以一个参数作为输入来调用存储过程。 The param can be any number from 1 to 10 and each returs different results. 参数可以是1到10之间的任何数字,并且每个参数都代表不同的结果。 Since it would make sphinx config quite crowded, even with inheritance. 因为它会使狮身人面像配置变得相当拥挤,即使继承也是如此。 So I thought I will use shebang line at the start of sphinx config file (stored as sphinx.py now). 所以我想我将在sphinx配置文件(现在存储为sphinx.py)的开头使用shebang行。 This works great in production enviroment since it runs on Ubuntu. 由于它在Ubuntu上运行,因此在生产环境中效果很好。 But I want to run it on my local machine as well, but here is the problem called - Windows. 但是我也想在本地计算机上运行它,但是这里有一个叫做Windows的问题。 Since I have cygwin as well, I tried to run it via cygwin, but it is the same - nothing happens. 由于我也有cygwin,因此我尝试通过cygwin运行它,但它是相同的-没有任何反应。

I tried to run with both cygwin paths and windows paths, but both get ignored or treated as comments. 我试图同时运行cygwin路径和Windows路径,但是两者都被忽略或视为注释。 From what I have read it should be working with cygwin. 根据我的阅读,它应该与cygwin一起使用。 Could it be that it does not work since I have to call an exe file? 可能是因为我必须调用exe文件,所以它不起作用了吗?

With: 带有:

$ ./indexer.exe sphinx.conf

I have tried to run it as perl script, bash script (via cygwin) and it gets ignored either way. 我试图将其作为perl脚本,bash脚本(通过cygwin)运行,并且无论哪种方式都将其忽略。

Is there a reliable way to run shebang lines on Windows? 是否有在Windows上运行shebang行的可靠方法? Or force cygwin to at least spit an error in my face... Even hacks are good since its just my development machine. 或强迫cygwin至少在我的脸上吐一个错误……即使是骇客也不错,因为它只是我的开发机器。

Any help is appreciated 任何帮助表示赞赏

All a shebang line does is tell the unix system() call what interpreter to use. shebang行所做的只是告诉unix system()调用要使用的解释器。 If you specify indexer.exe then you are saying that you want it to use indexer.exe, so that is what it will use. 如果指定indexer.exe,则表示您希望它使用indexer.exe,因此它将使用它。

If you run Indexer.exe, indexer.exe will decide what to do. 如果运行Indexer.exe,indexer.exe将决定要执行的操作。

Does Indexer.exe understand shebang lines? Indexer.exe是否了解shebang行? Or not? 或不?

Perl, as a convenience , will read the shebang line, and if it isn't Perl, it will and call the other program for you. 为了方便起见 ,Perl会读取shebang行,如果不是Perl,它将为您调用另一个程序。

So maybe call Perl instead of Indexer, and it will do the right thing? 因此,也许调用Perl而不是Indexer,它将做正确的事情?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM