GitHubのublockoriginプロジェクトに触発されたさまざまなブラウザー用のいくつかのアドオン/拡張機能を生成する gulp でいくつかの bash コードを書き直しています。
Firefox の場合、宛先ディレクトリを引数として取る Python スクリプトを実行することになっている行があります。gulp では、この python スクリプトを実行するのに苦労しています。
gulp-run
、gulp-shell
、を試しchild_process
ましたが、正しい出力が得られません。
python ./tools/make-firefox-meta.py ../firefox_debug/
コマンドラインから実行すると、目的の結果が得られ、firefox_debug
ディレクトリが作成されます。
これが私のコードですgulp-run
:
gulp.task("python-bsff", function(){
return run("python ./tools/make-firefox-meta.py ../firefox_debug/").exec();
});
これは、実際に何もせずにこれを私に与えています:
$ gulp python-bsff
[14:15:53] Using gulpfile ~\dev\gulpfile.js
[14:15:53] Starting 'python-bsff'...
[14:15:54] Finished 'python-bsff' after 629 ms
$ python ./tools/make-firefox-meta.py ../firefox_debug/
これが私のコードですgulp-shell
:
gulp.task("python-bsff", function(){
return shell.task(["./tools/make-firefox-meta.py ../firefox_debug/""]);
});
これは、実際の結果なしでこれを私に与えています:
$ gulp python-bsff
[14:18:54] Using gulpfile ~\dev\gulpfile.js
[14:18:54] Starting 'python-bsff'...
[14:18:54] Finished 'python-bsff' after 168 μs
のコードは次のchild_process
とおりです。これは、コマンドラインで python からの出力を見たので、最も有望なものでした。
gulp.task("python-bsff", function(){
var spawn = process.spawn;
console.info('Starting python');
var PIPE = {stdio: 'inherit'};
spawn('python', ["./tools/make-firefox-meta.py `../firefox_debug/`"], PIPE);
});
それは私にこの出力を与えています:
[14:08:59] Using gulpfile ~\dev\gulpfile.js
[14:08:59] Starting 'python-bsff'...
Starting python
[14:08:59] Finished 'python-bsff' after 172 ms
python: can't open file './tools/make-firefox-meta.py ../firefox_debug/`': [Errno 2] No such file or directory
誰か教えてください、それを機能させるにはどのような変更を行う必要がありますか?