How to use the child_process.execAsync function in child_process

To help you get started, we’ve selected a few child_process examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wisnuc / appifi / src / appifi / samba.js View on Github external
const initSamba = async () => {

  const logConfigPath = '/etc/rsyslog.d/99-smbaudit.conf'
  const logConfig = 'LOCAL7.*    @127.0.0.1:3721'

  // update rsyslog config if necessary
  let config = null
  try { config = await fs.readFileAsync(logConfigPath) } catch (e) {debug('initSamba: Not find Samba service')}
  if (config !== logConfig) {
    await fs.writeFileAsync(logConfigPath, logConfig)  
    await child.execAsync('systemctl restart rsyslog')
  }

  await child.execAsync('systemctl start nmbd')
  await child.execAsync('systemctl start smbd')
}
github wisnuc / appifi / src / fruitmix / lib / ref.js View on Github external
hash.update(text)
    digest = hash.digest().toString('hex')

    // await mkdirpAsync(this.docDir)
    tmppath = path.join(this.tmpDir, digest)
    filepath = path.join(this.docDir, digest)
    try {
      let stats = await fs.lstatAsync(filepath)
      return digest  
    }
    catch (e) {
      if (e.code !== 'ENOENT') throw e
    }
      
    await writeFileToDiskAsync(tmppath, text)
    await child.execAsync(`chmod 444 ${tmppath}`)
    await fs.renameAsync(tmppath, filepath)
    return digest
  }
github wisnuc / appifi / src / system / device.js View on Github external
const probeWS215iAsync = async () => {

  try {
    await fs.statAsync('/proc/BOARD_io')
    let arr = await Promise.all([
      child.execAsync('dd if=/dev/mtd0ro bs=1 skip=1697760 count=11'),
      child.execAsync('dd if=/dev/mtd0ro bs=1 skip=1697664 count=20'),
      child.execAsync('dd if=/dev/mtd0ro bs=1 skip=1660976 count=6 | xxd -p')
    ])
    return {
      serial: arr[0].toString(),
      p2p: arr[1].toString(),
      mac: arr[2].trim().match(/.{2}/g).join(':')
    }
  } catch (e) {}
}
github wisnuc / appifi / src / fruitmix / lib / samba.js View on Github external
const addUnixUserAsync = async (username, uid) => {

  debug('addUnixUser', username, uid)
  let cmd = 'adduser --disabled-password --disabled-login --no-create-home --gecos ",,," ' + 
    `--uid ${uid} --gid 65534 ${username}`
  return child.execAsync(cmd)
}
github TradeMe / tractor / packages / tractor-cli / src / init / install-tractor-locally.js View on Github external
function getInstalledTractorVersion () {
    info('Checking local "tractor" version...');
    return childProcess.execAsync(LOCAL_TRACTOR_VERSION_COMMAND)
    .then(local => {
        let { version } = JSON.parse(local).dependencies.tractor;
        info(`Local version of "tractor" is: ${version}`);
        return version;
    })
    .catch(() => {
        info('"tractor" is not installed.');
    });
}
github petkaantonov / HTML-Music-Player / build.js View on Github external
return Promise.all([fs.writeFileAsync(newDest, contents, "utf8"),
                                fs.writeFileAsync(minDest, minified.code, "utf8")]);
        });
    }, {concurrency: 4});

    return Promise.all(
        [codecs, css, cp.execAsync("browserify src/audio/AudioPlayerBackend.js --standalone AudioPlayer > dist/worker/AudioPlayerWorker.js", execOpts).then(function() {
            return fs.readFileAsync("dist/worker/AudioPlayerWorker.js", "utf8");
        }).then(function(contents) {
            contents = "self.DEBUGGING = false;\n" + contents;
            var minified = UglifyJS.minify(contents, {
                fromString: true
            });
            return fs.writeFileAsync("dist/worker/AudioPlayerWorker.min.js", minified.code, "utf8");
        }),
        cp.execAsync("browserify src/audio/TrackAnalyzerBackend.js --standalone TrackAnalyzer > dist/worker/TrackAnalyzerWorker.js", execOpts).then(function() {
            return fs.readFileAsync("dist/worker/TrackAnalyzerWorker.js", "utf8");
        }).then(function(contents) {
            contents = "self.DEBUGGING = false;\n" + contents;
            var minified = UglifyJS.minify(contents, {
                fromString: true
            });
            return fs.writeFileAsync("dist/worker/TrackAnalyzerWorker.min.js", minified.code, "utf8");
        }),
        cp.execAsync("browserify src/application.js --standalone Application > dist/main.js", execOpts)
    ]);
});
github TradeMe / tractor / packages / tractor-cli / src / init / install-tractor-locally.js View on Github external
function installTractor () {
    info('Installing "tractor"...');
    return childProcess.execAsync(INSTALL_DEPENDENCIES_COMMAND)
    .catch(() => error(`Couldn't install "tractor". Either run "tractor init" again, or install it manually by running "npm install tractor@latest --save-dev"`))
    .then(() => info('Installed "tractor".'));
}
github petkaantonov / HTML-Music-Player / build.js View on Github external
}).then(function() {
    return cp.execAsync("mv dist/css/min/app-css-public.css dist/css/app-css-public.min.css", execOpts);
}).then(function() {
    return fs.readFileAsync("dist/css/min/critical.css", "utf8");
github wisnuc / appifi / src / fruitmix / lib / samba.js View on Github external
const addSmbUsersAsync = async (fusers) => {

  let text = fusers.map(u => `${u.unixname}:${u.uid}:` + 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:' +
    `${u.md4}:[U          ]:${u.lct}:`).join('\n')

  debug('addSmbUsers', text)

  await mkdirpAsync('/run/wisnuc/smb')
  await fs.writeFileAsync('/run/wisnuc/smb/tmp', text)
  await child.execAsync('pdbedit -i smbpasswd:/run/wisnuc/smb/tmp')

  debug('addSmbUsers, after', await child.execAsync('pdbedit -Lw'))
}
github petkaantonov / HTML-Music-Player / build.js View on Github external
contents = "self.DEBUGGING = false;\n" + contents;
            var minified = UglifyJS.minify(contents, {
                fromString: true
            });
            return fs.writeFileAsync("dist/worker/AudioPlayerWorker.min.js", minified.code, "utf8");
        }),
        cp.execAsync("browserify src/audio/TrackAnalyzerBackend.js --standalone TrackAnalyzer > dist/worker/TrackAnalyzerWorker.js", execOpts).then(function() {
            return fs.readFileAsync("dist/worker/TrackAnalyzerWorker.js", "utf8");
        }).then(function(contents) {
            contents = "self.DEBUGGING = false;\n" + contents;
            var minified = UglifyJS.minify(contents, {
                fromString: true
            });
            return fs.writeFileAsync("dist/worker/TrackAnalyzerWorker.min.js", minified.code, "utf8");
        }),
        cp.execAsync("browserify src/application.js --standalone Application > dist/main.js", execOpts)
    ]);
});

child_process

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

65 / 100
Full package analysis