Tag: shelljs

节点具有完整path的asynchronousmkdir

我目前使用shell.js的mkdir -p在我的node.js代码是同步的。 在shell.mkdir中使用'-p'来创build一个完整path的目录,这是fs.mkdir无法做到的。 if(fs.existsSync(archivePath + "\\" + site + "\\" + year)){ // check if site folder exists console.log(archivePath + "\\" + site + "\\" + year + " exists"); } else { console.log(archivePath + "\\" + site + "\\" + year + " does not exist… creating full path now"); shell.mkdir('-p' , archivePath + […]

我想在Docker容器中编译代码,并能够创build容器,但无法获取callback函数中的任何数据

Dockerfile FROM chug/ubuntu14.04×64 # Update the repository sources list RUN echo "deb http://archive.ubuntu.com/ubuntu trusty main universe" > /etc/apt/sources.list RUN apt-get update # RUN apt-get upgrade # Install all the languages/compilers we are supporting. RUN apt-get install -y gcc RUN apt-get install -y g++ RUN apt-get install -y php5-cli RUN apt-get install -y ruby RUN apt-get […]

如何在同步模式下运行节点shelljs并获取stdout和stderr

在一个nodejs脚本中,我有下面的代码,它同时进行调用,并从我调用的shell脚本返回stdout: var sh = require('shelljs'); … some code var output = sh.exec('./someshellscript.sh', {silent:true}).stdout; console.log(output); … some more code (that shouldnt run until the script is complete) 我也可以运行下面的脚本,而不是返回stderr: var sh = require('shelljs'); … some code var output = sh.exec('./someshellscript.sh', {silent:true}).stderr; console.log(output); … some more code (that shouldnt run until the script is complete) 不过,我希望在同步调用中接收stdout和stderr。 它可能是非常明显的我在这里失踪,但我无法工作。 我想你以前可以在以前的版本中运行下面的命令,但是现在只是返回undefined: […]

shelljs的性能很慢

我一直在使用shelljs 在我的超高速系统上执行这个: var shell = require('shelljs') const exec = require('child_process').exec console.time('shell mktemp -d') shell.exec('mktemp -d', {silent: true}) console.timeEnd('shell mktemp -d') console.time('child exec mktemp -d') exec('mktemp', ['-d'], function(error, stdout, stderr) { if (error) { console.error('stderr', stderr) throw error } console.log('exec stdout', stdout) console.timeEnd('child exec mktemp -d') }) 它给出了以下执行时间: shell mktemp -d:208.126ms exec stdout /tmp/tmp.w22tyS5Uyu 孩子执行mktemp -d:48.812ms […]