 
 defmodule Serverboards.IoCmd do
 	use GenServer
+
+	defstruct [pid: nil]
 
 	@doc ~S"""
 	Runs a command (to properly shlex), and returns the handler to be able to


	"""
	def start_link(cmd, args \\ [], cmdopts \\ [], opts \\ []) do
		GenServer.start_link(__MODULE__, {cmd, args, cmdopts}, opts)
	end

	def init({cmd, args, cmdopts}) do
		fullcmd="#{System.cwd}/#{cmd}"

		cmdopts = cmdopts ++ [:stream, :line, :use_stdio, args: args]
		port = Port.open({:spawn_executable, cmd}, cmdopts)
		Logger.debug("Starting command #{fullcmd} at port #{inspect port}")
		Port.connect(port, self())

		state=%{

	"""
	def call(server, method, params) do
		Logger.debug("Calling #{method}(#{inspect params})")
		GenServer.call(server.pid, {:call, %{ method: method, params: params}})
	end

	def stop(server) do
		GenServer.stop(server.pid)
	end

	## server implementation
