spawn-multibyte.js 645 B

1234567891011121314151617
  1. // This is a test fixture for a case where spawn receives incomplete
  2. // multibyte strings in separate data events.
  3. // A multibyte buffer containing all our output. We will slice it later.
  4. // In this case we are using a Japanese word for hello / good day, where each
  5. // character takes three bytes.
  6. var fullOutput = new Buffer('こんにちは');
  7. // Output one full character and one third of a character
  8. process.stdout.write(fullOutput.slice(0, 4));
  9. // Output the rest of the string
  10. process.stdout.write(fullOutput.slice(4));
  11. // Do the same for stderr
  12. process.stderr.write(fullOutput.slice(0, 4));
  13. process.stderr.write(fullOutput.slice(4));