# A problem with the run/open function

**URL:** https://discourse.julialang.org/t/a-problem-with-the-run-open-function/98213
**Category:** New to Julia
**Tags:** question
**Created:** [May 2, 2023, 5:14pm UTC](https://discourse.julialang.org/t/a-problem-with-the-run-open-function/98213 "2023-05-02T17:14:44Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Charles\_Brauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charles_brauer/32/48688_2.png) [@Charles\_Brauer](https://discourse.julialang.org/u/Charles_Brauer)
#### Post date: [May 2, 2023, 5:14pm UTC](https://discourse.julialang.org/t/a-problem-with-the-run-open-function/98213/1 "2023-05-02T17:14:44Z")

</div>

#### My Environment

1. Windows 11 Pro, version 10.0.22621
2. Julia 1.8.5
3. Visual Studio Code, version 1.77.3

#### Background

I am trying to convert a program that is very important to our organization. The program runs on Window 11, and it uses C# and SQL Server to process high speed transactions from the major stock exchanges.

We subscribe to a streaming data feed from [IQFeed.net](http://IQFeed.net). This company provides language support for C++, C# and Python. I may be the first to try Julia.

[IQFeed.net](http://IQFeed.net) provides an App that is launched with command-line arguments. A TCP client then runs for 6.5 of the market hours. We connect to this client and start the data stream that consist of ASCI text records (about 80 characters). We parse the text and update a SQL Server database at the rate of about an average of 400 record/second. This rate varies. High burst rates may reach twice that amount.

On Windows, the Task Manager starts the program just before the market opens. The following image shows the Launcher App. The progress bar shows my commend line arguments are being processed, and the status window (red line) shows that no errors have occurred:

 ![Start](https://global.discourse-cdn.com/julialang/original/3X/0/0/00eaea0ebc420bd9e6f6ee9bd5920eab8ef679e5.jpeg)

#### My Problem

So, I thought this would be easy to do in Julia. The following Julia code is one of many tries to start the IQFeed Launcher.

```julia-auto
    using InteractiveUtils
    try
        iqconnect_path = raw"C:\Program Files\DTN\IQFeed\IQConnect.exe"
        arg1 = raw"-product CYPRESS_Point"
        arg2 = raw"-version 1.0"
        arg3 = raw"-login 123456"
        arg4 = raw"-password Foobar"
        arg5 = raw"-autoconnect"
        args = ["arg1", "arg2", "arg3", "arg4", "arg5"]
        open(`$iqconnect_path $args`)
    catch err
        @error "Error starting iqconnect: $err"
    end

```

When this Julia script runs in the REPL, the IQFeed Launcher appears, but it hangs. Without any error message. The picture below shows my problem.

 ![start-julia](https://global.discourse-cdn.com/julialang/original/3X/4/0/40c123b30dff9b35db4181f69c6eea60ca0ee54b.jpeg)

As you can see, the Launcher does not like the arguments.  
I have also tried other scripts, but without success. Here is what I have also tried:

```julia-auto
    run(`iqconnect arg1 arg2 arg3 arg4 arg5 true`)
    run(`iqconnect "-product CYPRESS_Point -login 123456 -password Foobar -autoconnect"`)
    run(`iqconnect -product CYPRESS_Point-login 123456 -password Foobar -autoconnect`)

```

My question is: “How can I debug the open (or run) command?”  
Any suggestions will be greatly appreciated.

Charles Brauer  
[CBrauer@CypressPoint.com](mailto:CBrauer@CypressPoint.com)

---

<div class="post-metadata">

### Author: ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)
#### Post date: [May 2, 2023, 5:46pm UTC](https://discourse.julialang.org/t/a-problem-with-the-run-open-function/98213/2 "2023-05-02T17:46:25Z")

</div>

This is probably not what you intended:

```julia
julia> `$iqconnect_path $args`
`'C:\Program Files\DTN\IQFeed\IQConnect.exe' arg1 arg2 arg3 arg4 arg5`

```

I assume you meant

```julia
args = [arg1, arg2, arg3, arg4, arg5]

```

However this also may not give what you wanted:

```julia
julia> `$iqconnect_path $args`
`'C:\Program Files\DTN\IQFeed\IQConnect.exe' '-product CYPRESS_Point' '-version 1.0' '-login 123456' '-password Foobar' -autoconnect`

```

Note that each argument is passed as a single string (e.g. `'-product CYPRESS_Point'`): the argument parser would typically expect this to be two separate strings `'-product'` and `'CYPRESS_Point'`.

I think what you actually want is something like:

```julia
        iqconnect_path = raw"C:\Program Files\DTN\IQFeed\IQConnect.exe"
        product = "CYPRESS_Point"
        version ="1.0"
        login = "123456"
        password = "Foobar"
        open(`$iqconnect_path -product $product -version $version -login $login -password $password -autoconnect`)

```

---

<div class="post-metadata">

### Author: ![Charles\_Brauer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charles_brauer/32/48688_2.png) [@Charles\_Brauer](https://discourse.julialang.org/u/Charles_Brauer)
#### Post date: [May 2, 2023, 8:51pm UTC](https://discourse.julialang.org/t/a-problem-with-the-run-open-function/98213/3 "2023-05-02T20:51:22Z")

</div>

Thank you very much Simon. Your last suggestion works great! I really appreciate your comments. I don’t think I could have come up with that solution by reading the “open” Man-page.
