How to use @kui-shell/plugin-bash-like - 3 common examples

To help you get started, we’ve selected a few @kui-shell/plugin-bash-like examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / kui / packages / proxy / app / routes / exec.js View on Github external
}

    const wsOpen = cmdline === 'bash websocket open'
    if (wsOpen) {
      // N is the random identifier for this connection
      const N = uuid()

      const session = existingSession || {
        uid,
        gid,
        token: uuid() // use a different uuid for the session cookie
      }
      const sessionToken = Buffer.from(JSON.stringify(session)).toString('base64')
      const cookie = { key: sessionKey, session }

      const { wss } = await wssMain(N, server, port, cookie)

      debug('spawning subprocess')
      const child = spawn(process.argv[0], [mainPath, 'bash', 'websocket', 'stdio'], options)

      child.on('error', err => {
        console.error('error spawning subprocess', err)
        reject(err)
      })

      child.on('exit', code => {
        debug('subprocess exit', code)
      })

      const channel = new StdioChannelWebsocketSide(wss)
      await channel.init(child, process.env.KUI_HEARTBEAT_INTERVAL || 30000)
github IBM / kui / plugins / plugin-proxy-support / src / lib / proxy-executor.ts View on Github external
return new Promise(async (resolve, reject) => {
          const uuid = uuidgen()
          debug('delegating to proxy websocket', command, uuid)

          const channel = await getSessionForTab(args.tab)

          const msg = {
            type: 'request',
            cmdline: command,
            uuid,
            cwd: process.env.PWD,
            execOptions: execOptionsForInvoke
          }
          channel.send(JSON.stringify(msg))

          const MARKER = '\n'
          let raw = ''
          const onMessage = (data: string) => {
            // debug('raw', uuid, data)
            raw += data
github IBM / kui / packages / proxy / app / routes / exec.js View on Github external
const { wss } = await wssMain(N, server, port, cookie)

      debug('spawning subprocess')
      const child = spawn(process.argv[0], [mainPath, 'bash', 'websocket', 'stdio'], options)

      child.on('error', err => {
        console.error('error spawning subprocess', err)
        reject(err)
      })

      child.on('exit', code => {
        debug('subprocess exit', code)
      })

      const channel = new StdioChannelWebsocketSide(wss)
      await channel.init(child, process.env.KUI_HEARTBEAT_INTERVAL || 30000)

      channel.once('closed', () => {
        debug('channel closed')
      })

      channel.once('open', () => {
        debug('channel open')

        const proto = process.env.KUI_USE_HTTP === 'true' ? 'ws' : 'wss'
        resolve({
          type: 'object',
          cookie: {
            key: sessionKey,
            value: sessionToken,
            path: `/bash/${N}`

@kui-shell/plugin-bash-like

Kui plugin that offers local bash-like shell integrations

Apache-2.0
Latest version published 2 years ago

Package Health Score

54 / 100
Full package analysis