hubot 11.1.8 → 11.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hubot",
3
- "version": "11.1.8",
3
+ "version": "11.1.9",
4
4
  "author": "hubot",
5
5
  "keywords": [
6
6
  "github",
@@ -76,10 +76,8 @@ class Shell extends Adapter {
76
76
  break
77
77
  }
78
78
  if (input.length > 0) {
79
- fs.appendFileSync(historyPath, `${input}\n`)
79
+ this.#rl.history.push(input)
80
80
  }
81
- const history = fs.readFileSync(historyPath, 'utf-8').split('\n').reverse()
82
- this.#rl.history = history
83
81
  let userId = process.env.HUBOT_SHELL_USER_ID || '1'
84
82
  if (userId.match(/A\d+z/)) {
85
83
  userId = parseInt(userId)
@@ -89,6 +87,9 @@ class Shell extends Adapter {
89
87
  await this.receive(new TextMessage(user, input, 'messageId'))
90
88
  this.#rl.prompt()
91
89
  })
90
+ this.#rl.on('history', async (history) => {
91
+ await fs.promises.writeFile(historyPath, history.reverse().join('\n'))
92
+ })
92
93
  try {
93
94
  this.#rl.prompt()
94
95
  this.emit('connected', this)