import { spawn } from 'child_process'
import { platform } from 'os'

class Command {
  public name: string
  public args: string[]
}

export function openTerminal(fullPath: string) {
  const currentPlatform = platform()
  const command = new Command()

  switch (currentPlatform) {
    case 'darwin': {
      command.name = 'open'
      command.args = [ '-a', 'Terminal', fullPath ]
      break
    }
    case 'win32': {
      command.name = 'start'
      command.args = [ '/D', '"%cd%"', 'cmd', fullPath ]
      break
    }
  }

  return spawn(command.name, command.args)
}
import { spawn } from 'child_process'
import { platform } from 'os'

export function openTerminal(fullPath: string) {
  const currentPlatform = platform()
  let command = ''

  switch (currentPlatform) {
    case 'darwin': {
      command = 'open -a Terminal'
      break
    }
    case 'win32': {
      command = 'start /D "%cd%" cmd'
      break
    }
  }

  return spawn('open', [ '-a', 'Terminal', fullPath ])
}
--- 
+++ 
@@ -1,20 +1,27 @@
 import { spawn } from 'child_process'
 import { platform } from 'os'
 
+class Command {
+  public name: string
+  public args: string[]
+}
+
 export function openTerminal(fullPath: string) {
   const currentPlatform = platform()
-  let command = ''
+  const command = new Command()
 
   switch (currentPlatform) {
     case 'darwin': {
-      command = 'open -a Terminal'
+      command.name = 'open'
+      command.args = [ '-a', 'Terminal', fullPath ]
       break
     }
     case 'win32': {
-      command = 'start /D "%cd%" cmd'
+      command.name = 'start'
+      command.args = [ '/D', '"%cd%"', 'cmd', fullPath ]
       break
     }
   }
 
-  return spawn('open', [ '-a', 'Terminal', fullPath ])
+  return spawn(command.name, command.args)
 }
Clean up open terminal function
