You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
undefined:1
^
SyntaxError: Unexpected token in JSON at position 0
at JSON.parse (<anonymous>)
at processLine (/Users/twodayslate/Development/swiftpackageregistry/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:401:24)
at pump (/Users/twodayslate/Development/swiftpackageregistry/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:393:9)
at IncomingMessage.onStreamEvent (/Users/twodayslate/Development/swiftpackageregistry/node_modules/dockerode/node_modules/docker-modem/lib/modem.js:384:5)
at IncomingMessage.emit (events.js:203:13)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:276:11)
at IncomingMessage.Readable.push (_stream_readable.js:210:10)
at HTTPParser.parserOnBody (_http_common.js:129:22)
at Socket.socketOnData (_http_client.js:449:22)
This seems like a docker-modemissue but I'm posting so others can get something working
varDocker=require('dockerode');vardocker=newDocker({socketPath: '/var/run/docker.sock'});varfs=require('fs');constprocess=require('process');functionrunCommand(container,cmd,callback){container.exec({Cmd: cmd,AttachStdin: true,AttachStdout: true},function(err,exec){if(err){console.log(err);returncallback(err);}exec.start({},function(err,stream){varnextDataType=null;varnextDataLength=null;varbuffer=Buffer.from('');functionprocessData(data){if(data){buffer=Buffer.concat([buffer,data]);}if(!nextDataType){if(buffer.length>=8){varheader=bufferSlice(8);nextDataType=header.readUInt8(0);nextDataLength=header.readUInt32BE(4);// It's possible we got a "data" that contains multiple messages// Process the next oneprocessData();}}else{if(buffer.length>=nextDataLength){varcontent=bufferSlice(nextDataLength);if(nextDataType===1){process.stdout.write(content);}else{process.stderr.write(content);}nextDataType=null;// It's possible we got a "data" that contains multiple messages// Process the next oneprocessData();}}}functionbufferSlice(end){varout=buffer.slice(0,end);buffer=Buffer.from(buffer.slice(end,buffer.length));returnout;}functiondidClose(){callback();}stream.on('data',processData);stream.on('close',didClose);});});}docker.createContainer({Image: 'swift:5.1.4',Cmd: ['/bin/bash'],AutoRemove: true,Tty: true,},function(err,container){container.start(function(err){console.log(err);runCommand(container,['swift','--version'],function(){runCommand(container,['git','--version'],function(){container.stop(function(err,data){container.remove(function(err,data){console.log("done :)")});});});});});});
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Open a new issue if needed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Open a new issue if needed.
This seems like a docker-modem issue but I'm posting so others can get something working
The text was updated successfully, but these errors were encountered: