mapbox / geobuf

A compact binary encoding for geographic data.
ISC License
967 stars 84 forks source link

Error with php exec #110

Closed 2803media closed 4 years ago

2803media commented 4 years ago

Hi The npm works with CLI on the console without any problem, but when I use it with php exec it gave me the following error after writting an empty file (so it's not a permission problem because it can write the .pbf) :

events.js:170
      throw er; // Unhandled 'error' event
      ^

Error: read EINVAL
    at Pipe.onStreamRead (internal/stream_base_commons.js:171:27)
Emitted 'error' event at:
    at emitErrorNT (internal/streams/destroy.js:91:8)
    at emitErrorAndCloseNT (internal/streams/destroy.js:59:3)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)

The code:

echo exec('/usr/bin/json2geobuf / data.json > data.pbf');

Any idea for this problem?

node -v v11.15.0

Update: I was able to get more detail with a cron command of this exec command:


undefined:1

SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at /usr/lib/node_modules/geobuf/bin/json2geobuf:12:24
    at ConcatStream.<anonymous> (/usr/lib/node_modules/geobuf/node_modules/concat-stream/index.js:37:43)
    at ConcatStream.emit (events.js:198:15)
    at finishMaybe (/usr/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:630:14)
    at endWritable (/usr/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:638:3)
    at ConcatStream.Writable.end (/usr/lib/node_modules/geobuf/node_modules/readable-stream/lib/_stream_writable.js:594:41)
    at Socket.onend (_stream_readable.js:667:10)
    at Object.onceWrapper (events.js:281:20)
    at Socket.emit (events.js:198:15)

As I said before it's working with the CLI, strange...

mourner commented 4 years ago

Sorry for a late reply! I assume you found the issue? Maybe the accidental slash in /usr/bin/json2geobuf / data.json?