KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums KX Academy Loading a directory path to IPC

  • Loading a directory path to IPC

    Posted by Laura on August 15, 2023 at 12:00 am

    What is the approach to load a directory into a IPC Handle? It is system “cd /my/directory/f1” normally, but if i want that loaded  into my h:hopen, I assume i have to do the system cd equivalent and pass to the handle?

    so…
    h:hopen 5000

    h( system “cd /my/directory”)

    Note/ Applicable to Question 3.1 of Advanced capstone

    Laura replied 9 months, 3 weeks ago 2 Members · 1 Reply
  • 1 Reply
  • gyorokpeter-kx

    Member
    August 15, 2023 at 12:00 am

    You can perform the “cd” command over IPC, but as this will change the current directory in the process, you should be sure that this won’t cause problems, as any code that depends on the current value of “cd” might break.

    Also if you are sending the command as a string to the handle, you have to escape any embedded quotes:

    h"system "cd /my/directory/f1""

    Or you could use a lambda with a dummy parameter instead:

    h({system "cd /my/directory/f1"};::)

     

Log in to reply.