Jump to content

Teo

Member
  • Posts

    10
  • Joined

  • Last visited

Posts posted by Teo

  1. A thread won't work. That's in the same process, so you'll have the same problem. It has to be a separate process, it must detach from its parent process and STDIN, STDOUT and STDERR, or Alfred won't consider the workflow complete.

    The way my Alfred-Workflow library starts a background process is a "proper" double fork, which is how you start a real daemon. That's probably overkill, and I did it that way basically because I already had the code. nohup would probably work just as well.

     

    I know, I corrected it to process :)

    I'm going to try the modal flag & nohup approach. 

    Thanks again.

  2. The background process is the main thing. If you can do the updating in a separate process, your workflow will be stupidly fast. Like instant.

     

    Perhaps you could use nohup to start the update process at the same time as your workflow? 

    # Detach from parent process and IO streams
    nohup ./myapp --update &> /dev/null &
     
    # Actual workflow script
    ./myapp "{query}"

    There's another Pinboard workflow that uses cron or launchd to update the cache frequently, while the workflow itself only uses the cached data.

     

    Two scripts/modalities is a great idea, especially if I can't get the app to spawn an independent process to do the updates.

  3. Please post the workflow/code somewhere.

     

    There's little use in guessing what might be wrong with something we've never seen.

     

    Thank you for your answer.

     

    The script (links to screenshots below) is a simple bash call to a command line app (https://github.com/NeoTeo/PinboardDailies).

     

    The command line app works as follows:

    1. Checks for a local cache of the xml that Alfred understands and outputs it immediately if found.

    2. Sends a query to Pinboard (a bookmark site with an api) and waits for the result.

    3. Writes the result to the local cache ready for next time.

     

    It appears that Alfred does not use the app's output until the app exits thus voiding the advantage of using the cache.

     

    https://ipfs.pics/QmSFvUcptQDSRsXxZGsFJESYJz1A2FkjJBm3qKfWNJNjcr

     

    https://ipfs.pics/QmWxqqFsnnfJRD8SMiciRUEYYeSQuGzxtiBZDfQok2xDW5

     

    https://ipfs.pics/QmWsPg7e9ieh91BAcCXtxbty7kF68D6gkuDACQfBGRjet1

  4. Hi everyone.

     

    I have a bash script that looks up my bookmarks on Pinboard.io and returns correctly formatted xml.

     

    Although the script outputs to stdout immediately, Alfred doesn't pass the output to the script filter until the whole (longer running) script has finished and returned. Is there a way to avoid this delay?

     

    Cheers,

    Teo

  5. Hi Alfred users.

     

    I'm not completely sure this is a bug so I'm posting it here first. 

     

    I have written a script that outputs xml which some times contains special characters.

    It seems that the xml interpreter in Alfred does not know what to do with those and aborts the whole script filter without any error in the debug log. A simple example would be:

     

    <?xml version="1.0" encoding="UTF-8"?><items><item arg="http://www.glossed.it/highlights" valid="YES" type="file"><title>title Ð</title><subtitle>test</subtitle><icon type="fileicon"></icon></item></items>

     

    I've coloured the offending character red. Without it the script filter works fine.

     

    Am I correct in thinking this is a bug in Alfred?

     

    Best regards,

    Teo

×
×
  • Create New...