草庐IT

process_output

全部标签

node.js - 当 Node 进程被杀死时杀死所有child_process

当父进程被杀死时,我如何确保所有子进程都被杀死。我有类似下面的东西。即使Node进程被杀死,我也看到FFMPEG继续运行并生成了out.avi。Node进程退出后如何阻止FFMPEG运行。varargs="ffmpeg-iin.aviout.avi"child_process.exec(args,function(err,stdout,stderr){});child_process.exec(args,function(err,stdout,stderr){}); 最佳答案 你需要监听进程退出事件然后杀死子进程。这应该适合你:va

css - 使用 Webpack,是否可以只生成 CSS,不包括 output.js?

我正在使用Webpack与extract-text-webpack-plugin.在我的元素中,我有一些构建脚本。其中一个构建脚本应该只捆绑和缩小CSS。由于我将Webpack用于其他脚本,因此我发现使用Webpack是个好主意,即使我只想打包和缩小CSS。它工作正常,除了我无法摆脱output.js文件。我不想要生成的webpack输出文件。我只想要这个特定脚本的CSS。有没有办法摆脱生成的JS?如果没有,您是否建议任何其他专门用于处理CSS的工具?谢谢。 最佳答案 有一个简单的方法,不需要额外的工具。有一个简单的方法,您不需要额

xml2js : how is the output?

我正在尝试使用node.js模块xml2js我的代码很简单:functiontestparse(pathname,callback){varparser=require('xml2js').Parser(),util=require('util'),fs=require('fs'),fs.readFile(pathname,function(err,data){parser.parseString(data,function(err,result){console.log('Completeresult:');console.log(util.inspect(result,{depth

node.js - Gradle "... occurred starting process ' 命令 'npm' '"在 Mac 上

我安装了带有IntelliJIdea的MacOS。我正在使用Gradle(gradle-2.4)来构建项目。我在Mac上安装了NodeJS和NPM,并且可以从shell中使用。MacBook:~user$node-vv4.2.2MacBook:~user$npm-v2.14.7运行使用NODE/NPM的Gradle任务时,它会失败并出现以下错误(在当前示例中为NPM)。*Whatwentwrong:Executionfailedfortask':module:task'.>Aproblemoccurredstartingprocess'command'npm''来自Gradle的错误堆

node.js - Grunt : execute node process and watch 中的类似 Nodemon 的任务

我觉得我错过了什么。这是我想要实现的目标:有一个执行我的server.js并并行运行watch任务的grunt任务。在我看来,这正是grunt设计的任务之一,但我无法实现这种配置。除其他外,我读过这个:RunningNodeappthroughGrunt但我还是做不到。这是我的Gruntfile.js:module.exports=function(grunt){//Projectconfiguration.grunt.initConfig({watch:{scripts:{files:['*.js'],tasks:['start'],options:{nospawn:true}}}}

javascript - process.stdin 流的可读事件和数据事件有什么区别?

说我有process.stdin.setEncoding('utf8');varmyString='';两者有什么区别process.stdin.on('readable',function(){myString+=process.stdin.read();});和process.stdin.on('data',function(chunk){myString+=chunk;});如果输入字符串在标准输入结束后相同,他们会给我相同的myString每种方法的最佳做法是什么?谢谢 最佳答案 它们是两个不同的API,允许您访问相同的数据

javascript - 从命令行读取参数 - 错误 TS2304 : Cannot find name 'process'

使用TypeScript1.7.5版。我正在编写一个nodeJS程序,我想在其中读取用户传递的命令行参数(2个整数)。在原始JavaScript中一切正常,但TypeScript出现问题。当process.argv在TypeScript文件中使用,当它被编译为JavaScript时,编译器会出错,因为它无法识别“进程”变量。errorTS2304:Cannotfindname'process'我已尝试在文件顶部声明一个新的var“进程”,但这会覆盖native变量并且它不再包含参数...我想将所有代码都保留在TypeScript中,只在构建时编译为JavaScript。解决此问题的最佳

node.js - - 使用 Webpack 的 configuration.output.path : The provided value "public" is not an absolute path!

我正在使用基于WebPack的LaravelMix。我让它工作了,现在它失败了:Invalidconfigurationobject.WebpackhasbeeninitialisedusingaconfigurationobjectthatdoesnotmatchtheAPIschema.-configuration.output.path:Theprovidedvalue"public"isnotanabsolutepath!如果我删除我的webpack.mix.js内容,它仍然会以同样的方式失败。你能帮我调试一下这个错误吗,我不知道如何继续。我已经删除了node_modules文

node.js - Nodejs子进程: write to stdin from an already initialised process

我正在尝试使用Node的child_process生成一个外部进程phantomjs,然后在初始化后向该进程发送信息,这可能吗?我有以下代码:varspawn=require('child_process').spawn,child=spawn('phantomjs');child.stdin.setEncoding='utf-8';child.stdout.pipe(process.stdout);child.stdin.write("console.log('HellofromPhantomJS')");但我在标准输出上得到的唯一信息是phantomjs控制台的初始提示。phant

javascript - 如何使用 Bluebird promise Node 的 child_process.exec 和 child_process.execFile 函数?

我正在使用Node.js下的BluebirdPromise库,非常棒!但我有一个问题:如果您查看Node的文档child_process.exec和child_process.execFile你可以看到这两个函数都返回了一个ChildProcess对象。那么推荐的方法是什么?请注意以下工作(我得到一个Promise对象):varPromise=require('bluebird');varexecAsync=Promise.promisify(require('child_process').exec);varexecFileAsync=Promise.promisify(requir