first commit

This commit is contained in:
编码猿
2024-09-27 01:14:21 +08:00
commit 5ddcc17391
52 changed files with 1176 additions and 0 deletions

21
test.js Normal file
View File

@@ -0,0 +1,21 @@
const {spawn} = require('child_process');
const fs = require('fs');
const spawnObj = spawn('ping', ['127.0.0.1'], {encoding: 'utf-8'});
spawnObj.stdout.on('data', function(chunk) {
console.log(chunk.toString());
});
spawnObj.stderr.on('data', (data) => {
console.log(data);
});
spawnObj.on('close', function(code) {
console.log('close code : ' + code);
})
spawnObj.on('exit', (code) => {
console.log('exit code : ' + code);
fs.close(fd, function(err) {
if(err) {
console.error(err);
}
});
});