« get me outta code hell

Add a bunch of code commenting, and a skip up-next method - http-music - Command-line music player + utils (not a server!)
about summary refs log tree commit diff
path: root/src/promisify-process.js
diff options
context:
space:
mode:
authorliam4 <towerofnix@gmail.com>2017-06-11 12:29:17 -0300
committerliam4 <towerofnix@gmail.com>2017-06-11 19:50:34 -0300
commit791c62508c00de07e3190c078824d8277926673d (patch)
tree739cd3fd22ae15f7dba988922a030543fbb9fa0e /src/promisify-process.js
parentb1184c312d3963de5b324777f4a743be057535f1 (diff)
Add a bunch of code commenting, and a skip up-next method
Diffstat (limited to 'src/promisify-process.js')
-rw-r--r--src/promisify-process.js24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/promisify-process.js b/src/promisify-process.js
index 4d06f8c..d1c09d7 100644
--- a/src/promisify-process.js
+++ b/src/promisify-process.js
@@ -2,26 +2,14 @@
 
 const { Writable } = require('stream')
 
-module.exports = function promisifyProcess(proc, showLogging = true) {
-  // Takes a process (from child_process) and returns a promise that resolves
-  // when the process exits (or rejects with a warning, if the exit code is
-  // non-zero).
+module.exports = function promisifyProcess(proc) {
+  // Takes a process (from the child_process module) and returns a promise that
+  // resolves when the process exits (or rejects with a warning, if the exit
+  // code is non-zero).
 
   return new Promise((resolve, reject) => {
-    if (showLogging) {
-      proc.stdout.pipe(process.stdout)
-      proc.stderr.pipe(process.stderr)
-    } else {
-      // For some mysterious reason, youtube-dl doesn't seem to work unless
-      // we pipe the output of it SOMEWHERE..
-
-      const emptyStream = () => Object.assign(new Writable(), {
-        write: () => {}
-      })
-
-      proc.stdout.pipe(emptyStream())
-      proc.stderr.pipe(emptyStream())
-    }
+    proc.stdout.pipe(process.stdout)
+    proc.stderr.pipe(process.stderr)
 
     proc.on('exit', code => {
       if (code === 0) {