Skip to content
This repository has been archived by the owner on Oct 22, 2023. It is now read-only.

Commit

Permalink
fix maxBuffer exceeded error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Zhang committed Jun 13, 2018
1 parent c03fdde commit 8027164
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
22 changes: 12 additions & 10 deletions src/main/index.js
Expand Up @@ -138,7 +138,7 @@ app.on('ready', () => {
// aria2
function startAria2 () {
const AppData = require('./appdata').default
const spawn = require('child_process').spawn
const exec = require('child_process').exec
const join = require('path').join
const platform = require('os').platform()
const homedir = require('os').homedir()
Expand All @@ -156,17 +156,19 @@ function startAria2 () {
'input-file': session,
'save-session': session,
'dht-file-path': join(datadir, 'dht.dat'),
'dht-file-path6': join(datadir, 'dht6.dat')
'dht-file-path6': join(datadir, 'dht6.dat'),
'quiet': 'true'
}, AppData.readData() || {})
if (!options.hasOwnProperty('dir')) options['dir'] = join(homedir, 'Downloads')

let command = '"' + aria2c + '"'
let args = ['--conf-path="' + conf + '"']
for (let key in options) args.push('--' + key + '="' + options[key] + '"')
let subprocess = spawn(command, args, { shell: true })
subprocess.on('exit', (code, signal) => {
if (code === 1) dialog.showErrorBox('Warning', 'conflicts with an existing aria2 instance. Please stop the instance and reopen the app.')
app.quit()
let command = '"' + aria2c + '" --conf-path="' + conf + '"'
for (let key in options) command += ' --' + key + '="' + options[key] + '"'
return exec(command, (error, stdout, stderr) => {
if (error) {
console.error(error.message)
const message = 'conflicts with an existing aria2 instance. Please stop the instance and reopen the app.'
dialog.showErrorBox('Warning', message)
app.quit()
}
})
return subprocess
}
2 changes: 2 additions & 0 deletions static/aria2/aria2.conf
Expand Up @@ -15,6 +15,8 @@ continue=true
max-overall-download-limit=0
# Set max download speed per each download in bytes/sec. 0 means unrestricted. Default: 0
# max-download-limit=0
# Make aria2 quiet (no console output). Default: false
quiet=true


### Advanced ###
Expand Down

0 comments on commit 8027164

Please sign in to comment.